In [1]:
import pandas as pd
import matplotlib.pyplot as plt
In [2]:
%matplotlib inline
In [3]:
import ext_datos as ext
import procesar as pro
import time_plot as tplt
In [4]:
dia1 = ext.extraer_data('dia1')
In [5]:
cd ..
In [6]:
dia2 = ext.extraer_data('dia2')
In [7]:
cd ..
In [8]:
dia3 = ext.extraer_data('dia3')
In [9]:
cd ..
In [10]:
dia4 = ext.extraer_data('dia4')
In [11]:
motoresdia1 = pro.procesar(dia1)
In [12]:
motoresdia2 = pro.procesar(dia2)
In [13]:
motoresdia3 = pro.procesar(dia3)
In [14]:
motoresdia4 = pro.procesar(dia4)
In [15]:
motoresdia4['pot_m2']=motoresdia4.busCurrent_m2*motoresdia4.busVoltage_m2
In [16]:
motoresdia4['pot_m1']=motoresdia4.busCurrent_m1*motoresdia4.busVoltage_m1
In [17]:
motoresdia3['pot_m2']=motoresdia3.busCurrent_m2*motoresdia3.busVoltage_m2
motoresdia3['pot_m1']=motoresdia3.busCurrent_m1*motoresdia3.busVoltage_m1
In [18]:
motoresdia2['pot_m2']=motoresdia2.busCurrent_m2*motoresdia2.busVoltage_m2
motoresdia2['pot_m1']=motoresdia2.busCurrent_m1*motoresdia2.busVoltage_m1
In [19]:
motoresdia1['pot_m2']=motoresdia1.busCurrent_m2*motoresdia1.busVoltage_m2
motoresdia1['pot_m1']=motoresdia1.busCurrent_m1*motoresdia1.busVoltage_m1
Se calcula la potencia promedio de todos los datos positivos que se obtienen de cada motor
In [20]:
promediodia4_pot_m1_todos_positivos=motoresdia4[motoresdia4.pot_m1>0].pot_m1.dropna().mean()
promediodia4_pot_m1_todos_positivos
Out[20]:
In [21]:
promediodia4_pot_m1_algunos_positivos = motoresdia4[motoresdia4.pot_m1>0].dropna().pot_m1.mean()
promediodia4_pot_m1_algunos_positivos
Out[21]:
Se observa que la variación de potencia promedio tomando los datos solo entre aquellos en donde existe información de ambos motores no es significativa respecto a la potencia promedio tomando el total de datos de cada motor por separado, sin usar la muestra que coincida en espacio temporal
In [22]:
promediodia4_pot_m2_todos_positivos = motoresdia4[motoresdia4.pot_m2>0].pot_m2.dropna().mean()
promediodia4_pot_m2_todos_positivos
Out[22]:
In [23]:
promediodia4_pot_m2_algunos_positivos = motoresdia4[motoresdia4.pot_m2>0].dropna().pot_m2.mean()
promediodia4_pot_m2_algunos_positivos
Out[23]:
Se verifica con el segundo motor, que es el que tiene menos potencia y menos datos, en el día 2 es un 80% y el primero casi el 100%, en los otros días puede variar la apreciación
Potencia promedio consumida con 360 Kg último día ambos motores solo acelerendo, pot > 0
In [24]:
pot_prom_ambos_dia4 = promediodia4_pot_m1_algunos_positivos+promediodia4_pot_m2_algunos_positivos
pot_prom_ambos_dia4
Out[24]:
Potencia promedio entregada por regeneración
In [25]:
promediodia4_pot_m1_algunos_negativos = motoresdia4[motoresdia4.pot_m1<0].dropna().pot_m1.mean()
promediodia4_pot_m1_algunos_negativos
Out[25]:
In [26]:
promediodia4_pot_m2_algunos_negativos = motoresdia4[motoresdia4.pot_m2<0].dropna().pot_m2.mean()
promediodia4_pot_m2_algunos_negativos
Out[26]:
In [27]:
pot_prom_reg_ambos_dia4 = promediodia4_pot_m1_algunos_negativos+promediodia4_pot_m2_algunos_negativos
pot_prom_reg_ambos_dia4
Out[27]:
In [28]:
abs(pot_prom_reg_ambos_dia4/pot_prom_ambos_dia4)
Out[28]:
Potencia promedio dia 4 consumida y regenerada a la vez
In [29]:
promediodia4_pot_m1_algunos_ambos = motoresdia4[motoresdia4.pot_m1!=0].dropna().pot_m1.mean()
promediodia4_pot_m1_algunos_ambos
Out[29]:
In [30]:
promediodia4_pot_m2_algunos_ambos = motoresdia4[motoresdia4.pot_m2!=0].dropna().pot_m2.mean()
promediodia4_pot_m2_algunos_ambos
Out[30]:
In [31]:
pot_prom_cons_y_reg = promediodia4_pot_m1_algunos_ambos+promediodia4_pot_m2_algunos_ambos
pot_prom_cons_y_reg
Out[31]:
Impacto uso de regenerativo ultimo dia de carrera
In [32]:
1 - pot_prom_cons_y_reg/(pot_prom_ambos_dia4)
Out[32]:
In [33]:
motoresdia4.pot_m2[10000:30000].plot()
Out[33]:
Promedio día 4 incluyendo recargo de celdas.. solo en intervalo donde existen datos de ambos motores
In [34]:
promediodia4_pot_m1_algunos_todo = motoresdia4.dropna().pot_m1.mean()
promediodia4_pot_m1_algunos_todo
Out[34]:
In [35]:
promediodia4_pot_m2_algunos_todo = motoresdia4.dropna().pot_m2.mean()
promediodia4_pot_m2_algunos_todo
Out[35]:
In [36]:
promediototalconsumo = promediodia4_pot_m2_algunos_todo+promediodia4_pot_m1_algunos_todo
promediototalconsumo
Out[36]:
Impacto carga de celdas
In [37]:
1-promediototalconsumo/pot_prom_cons_y_reg
Out[37]:
Validación en un intervalo de competencia solamente, no luego de llegar y recargar.. solo en carrera
In [38]:
promediodia4_pot_m1_algunos_todo_val = motoresdia4.dropna().pot_m1[0:110000].mean()
promediodia4_pot_m1_algunos_todo_val
Out[38]:
In [39]:
promediodia4_pot_m2_algunos_todo_val = motoresdia4.dropna().pot_m2[0:110000].mean()
promediodia4_pot_m2_algunos_todo_val
Out[39]:
In [40]:
promediototalconsumo_val = promediodia4_pot_m2_algunos_todo_val+promediodia4_pot_m1_algunos_todo_val
promediototalconsumo_val
Out[40]:
In [41]:
1-promediototalconsumo_val/pot_prom_cons_y_reg
Out[41]:
In [42]:
jdj
In [43]:
1+1
Out[43]:
In [44]:
maximo_m1
In [45]:
len(motoresdia4[motoresdia4.pot_m1<0].pot_m1.dropna())
Out[45]:
In [46]:
promedio_pot_m1_algunos=motoresdia4[motoresdia4.pot_m1<0].dropna().pot_m1.mean()
In [47]:
len(motoresdia4[motoresdia4.pot_m1<0].dropna().pot_m1)
Out[47]:
In [48]:
motoresdia4[motoresdia4.pot_m1<0].dropna().pot_m1.mean()
Out[48]:
In [49]:
motoresdia4[motoresdia4.pot_m2<0].dropna().pot_m2.mean()
Out[49]:
In [50]:
motoresdia4[motoresdia4.pot_m2!=0].pot_m2.dropna().mean()
Out[50]:
In [51]:
1343+1130
Out[51]:
In [52]:
motoresdia3['pot_m2']=motoresdia3.busCurrent_m2*motoresdia3.busVoltage_m2
In [53]:
motoresdia3['pot_m1']=motoresdia3.busCurrent_m1*motoresdia3.busVoltage_m1
In [54]:
motoresdia3[motoresdia3.pot_m1<0].pot_m1.dropna().mean()
Out[54]:
In [55]:
motoresdia3[motoresdia3.pot_m2<0].pot_m2.dropna().mean()
Out[55]:
In [56]:
motoresdia2['pot_m2']=motoresdia2.busCurrent_m2*motoresdia2.busVoltage_m2
In [57]:
motoresdia2['pot_m1']=motoresdia2.busCurrent_m1*motoresdia2.busVoltage_m1
In [58]:
motoresdia2[motoresdia2.pot_m1<0].pot_m1.dropna().mean()
Out[58]:
In [59]:
motoresdia2[motoresdia2.pot_m2<0].pot_m2.dropna().mean()
Out[59]:
In [60]:
motoresdia1['pot_m2']=motoresdia1.busCurrent_m2*motoresdia1.busVoltage_m2
In [61]:
motoresdia1['pot_m1']=motoresdia1.busCurrent_m1*motoresdia1.busVoltage_m1
In [62]:
motoresdia1[motoresdia1.pot_m1!=0].pot_m1.dropna().mean()
Out[62]:
In [63]:
motoresdia1[motoresdia1.pot_m2!=0].pot_m2.dropna().mean()
Out[63]:
In [64]:
import scipy.integrate as integr
In [97]:
integr.trapz(motoresdia4.pot_m2.dropna(),motoresdia4.pot_m2.dropna().index.values)
Out[97]:
In [89]:
from scipy import integrate
import pandas as pd
import numpy as np
def integrate_method(self, how='trapz', unit='s'):
'''Numerically integrate the time series.
@param how: the method to use (trapz by default)
@return
Available methods:
* trapz - trapezoidal
* cumtrapz - cumulative trapezoidal
* simps - Simpson's rule
* romb - Romberger's rule
See http://docs.scipy.org/doc/scipy/reference/integrate.html for the method details.
or the source code
https://github.com/scipy/scipy/blob/master/scipy/integrate/quadrature.py
'''
available_rules = set(['trapz', 'cumtrapz', 'simps', 'romb'])
if how in available_rules:
rule = integrate.__getattribute__(how)
else:
print('Unsupported integration rule: %s' % (how))
print('Expecting one of these sample-based integration rules: %s' % (str(list(available_rules))))
raise AttributeError
result = rule(self.values, self.index.astype(np.int64) / 10**9)
#result = rule(self.values)
return result
pd.TimeSeries.integrate = integrate_method
In [105]:
energia1=motoresdia4.dropna().pot_m2.integrate()/3600
energia1
Out[105]:
In [106]:
energia2=motoresdia4.dropna().pot_m1.integrate()/3600
energia2
Out[106]:
In [107]:
energiatotal=energia1+energia2
energiatotal
Out[107]:
In [110]:
energiaconsumida2=motoresdia4[motoresdia4.pot_m2>0].dropna().pot_m2.integrate()/3600
energiaconsumida2
Out[110]:
In [111]:
energiaconsumida1=motoresdia4[motoresdia4.pot_m1>0].dropna().pot_m2.integrate()/3600
energiaconsumida1
Out[111]:
In [112]:
energiaconsumidatotal=energiaconsumida1+energiaconsumida2
energiaconsumidatotal
Out[112]:
In [114]:
(1-(energiatotal/energiaconsumidatotal))*100
Out[114]:
In [ ]:
In [105]:
Out[105]: